package com.hspedu.seckill.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hspedu.seckill.entity.Order;
import com.hspedu.seckill.entity.User;
import com.hspedu.seckill.model.vo.GoodsVo;

/**
 * @author: xujiabing
 * @date: 2024-10-05 16:36
 * @description
 */
public interface OrderService extends IService<Order> {

    /**
     * 秒杀下单接口实现
     * @param user
     * @param goodsVo
     * @return
     */
    Order seckill(User user, GoodsVo goodsVo);

    /**
     * @description: 生成下单校验uuid
     * @author: xujiabing
     * @date: 2025-01-27 17:20
     * @param: user
     * @param: goodsVo
     * @return: String
     */
    String genOnOrderUUID(User user, Long goodsId);

    /**
     * @description: 校验下单uuid
     * @author: xujiabing
     * @date: 2025-01-27 17:20
     * @param: user
     * @param: goodsVo
     * @param: uuid
     * @return: Boolean
     */
    Boolean checkOnOrderUUID(User user, Long goodsId, String uuid);

    /**
     * 生成秒杀验证码缓存key
     * @param userId
     * @param goodsId
     * @return
     */
    String genCaptchaCacheKey(String userId, String goodsId);

    /**
     * 校验秒杀验证码
     * @param userId 用户ID
     * @param goodsId 商品ID
     * @param captchaValue 用户输入的验证码值
     * @return
     */
    boolean checkCaptcha(String userId, String goodsId, String captchaValue);
}
